import { createRouter, createWebHistory } from 'vue-router';
import Dashboard from '../views/Dashboard.vue';
import management from '../views/prodeucts/management.vue';
import StockManagement from '../views/prodeucts/StockManagement.vue';
import ProductCategory from '../views/prodeucts/ProductCategory.vue';
import ProductRelease from '../views/prodeucts/ProductRelease.vue';
import ProductFeedback from '../views/prodeucts/ProductFeedback.vue' 
import PointsManagement from '../views/PointsManagement.vue';
import Orders from '../views/Orders.vue';
import Users from '../views/Users.vue';
import Reports from '../views/Reports.vue';
import Settings from '../views/Settings.vue';
import LoginPage from '../views/LoginPage.vue';
import RegisterPage from '../views/RegisterPage.vue' 
import IndexView from '../views/IndexView.vue' 
import TransactionManagement from '../views/TransactionManagement.vue' 
import MessageManagement from '../views/MessageManagement.vue' 
import CommunityManagement from '../views/CommunityManagement.vue' 
import PromotionManagement from '../views/PromotionManagement.vue' 
import ProfilePage from '../views/ProfilePage.vue' 
import DataAnalysis from '../views/DataAnalysis.vue'

const routes = [
 
  {
    path: '/LoginPage',
    name: 'LoginPage',
    component: LoginPage,
  },
  {
    path: '/LoginPage',
    redirect: '/LoginPage' // 重定向根路径到登录页
  },
  {
    path: '/register',
    name: 'Register',
    component: RegisterPage,
  },
  {
    path: '/ProfilePage',
    name: 'ProfilePage',
    component: ProfilePage,
  },
  {
    path: '/',
    name: 'IndexView',
    component: IndexView,
    children: [
      {
        path: '/Dashboard',
        name: 'Dashboard',
        component: Dashboard,
      },
      {
        path: '', // 默认子路由
        redirect: '/dashboard', // 重定向到 Dashboard
      },
      {
        path: '/products/management',
        name: 'management',
        component: management,
      },
      {
        path: '/products/StockManagement',
        name: 'StockManagement',
        component: StockManagement,
      },
      {
        path: '/products/ProductRelease',
        name: 'ProductRelease',
        component: ProductRelease,
      },
      {
        path: '/products/ProductCategory',
        name: 'ProductCategory',
        component: ProductCategory,
      },
      {
        path: '/products/ProductFeedback',
        name: 'ProductFeedback',
        component: ProductFeedback,
      },
      {
        path: '/orders',
        name: 'Orders',
        component: Orders,
      },
      {
        path: '/users',
        name: 'Users',
        component: Users,
      },
      {
        path: '/reports',
        name: 'Reports',
        component: Reports,
      },
      {
        path: '/settings',
        name: 'Settings',
        component: Settings,
      },
      {
        path: '/points-management',
        name: 'PointsManagement',
        component: PointsManagement,
      },
      {
        path: '/TransactionManagement',
        name: 'TransactionManagement',
        component: TransactionManagement,
      },
      {
        path: '/MessageManagement',
        name: 'MessageManagement',
        component: MessageManagement,
      },
      {
        path: '/CommunityManagement',
        name: 'CommunityManagement',
        component: CommunityManagement,
      },
      {
        path: '/PromotionManagement',
        name: 'PromotionManagement',
        component: PromotionManagement,
      },
      {
        path:'/DataAnalysis',
        name : '/DataAnalysis',
        component:DataAnalysis,
      }
    ],
  },
  // Add more routes here
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
